import 'package:base/main.dart';
import 'package:flutter/material.dart';

class HomeSearchWidget extends StatelessWidget {
  double progress;

  HomeSearchWidget({super.key, required this.progress});

  @override
  Widget build(BuildContext context) {
    String text = progress == 1 ? "" : "聚名网";
    double height = 36;
    double paddingHeight = progress == 1 ? 8 : 5;
    var widthPro = 1 - progress;
    if (widthPro <= 0.9) {
      widthPro = 0.9;
    }
    height = height * widthPro;
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      mainAxisAlignment: MainAxisAlignment.start,
      children: [
        Padding(
          padding: EdgeInsets.only(left: 20, top: 20),
          child: Text(" $text",
              style: TextStyle(fontSize: 16, color: Colors.white)),
        ),
        SizedBox(height: paddingHeight),
        Container(
          height: height,
          margin: EdgeInsets.symmetric(horizontal: 16),
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(8),
            color: Colors.white,
            boxShadow: [BoxShadow(color: Colors.white, blurRadius: 1)],
          ),
          child: Row(
            children: [
              const SizedBox(width: 8),
              ImageLoader.asset(
                  path: 'assets/images/icons/index_36@3x.png',
                  width: 16,
                  height: 16),
              const SizedBox(width: 8),
              const Text('查交易、whois、注册/功能',
                  style: TextStyle(
                      fontSize: 12,
                      color: Colors.grey,
                      fontWeight: FontWeight.w500)),
            ],
          ),
        )
      ],
    );
  }
}
